using System;
using Microsoft.Practices.Unity;

namespace Unity.Extensions
{
    class ObjectFactory : IObjectFactory
    {
        readonly IUnityContainer container;

        public ObjectFactory(IUnityContainer container)
        {
            this.container = container;
        }

        public object Get(Type typeToBuild)
        {
            return container.Resolve(typeToBuild);
        }

        public TToBuild Get<TToBuild>()
        {
            return container.Resolve<TToBuild>();
        }
    }
}